/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.openbrew.openbrewrf;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author chapmand
 */
@Entity
@Table(name = "TastePanel")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TastePanel.findAll", query = "SELECT t FROM TastePanel t"),
    @NamedQuery(name = "TastePanel.findByTastePanelID", query = "SELECT t FROM TastePanel t WHERE t.tastePanelID = :tastePanelID"),
    @NamedQuery(name = "TastePanel.findByTastePanelType", query = "SELECT t FROM TastePanel t WHERE t.tastePanelType = :tastePanelType"),
    @NamedQuery(name = "TastePanel.findByTastePanelEmpCSV", query = "SELECT t FROM TastePanel t WHERE t.tastePanelEmpCSV = :tastePanelEmpCSV"),
    @NamedQuery(name = "TastePanel.findByTastePanelDate", query = "SELECT t FROM TastePanel t WHERE t.tastePanelDate = :tastePanelDate"),
    @NamedQuery(name = "TastePanel.findByTastePanelNotes", query = "SELECT t FROM TastePanel t WHERE t.tastePanelNotes = :tastePanelNotes")})
public class TastePanel implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "TastePanelID")
    private Integer tastePanelID;
    @Basic(optional = false)
    @NotNull
    @Column(name = "TastePanelType")
    private int tastePanelType;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 250)
    @Column(name = "TastePanelEmpCSV")
    private String tastePanelEmpCSV;
    @Basic(optional = false)
    @NotNull
    @Column(name = "TastePanelDate")
    @Temporal(TemporalType.DATE)
    private Date tastePanelDate;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 500)
    @Column(name = "TastePanelNotes")
    private String tastePanelNotes;
    @JoinColumn(name = "TastePanelBeerID1", referencedColumnName = "TPBID", nullable=true)
    @ManyToOne(optional = true)
    private TastePanelBeer tastePanelBeerID1;
    @JoinColumn(name = "TastePanelBeerID2", referencedColumnName = "TPBID", nullable=true)
    @ManyToOne(optional = true)
    private TastePanelBeer tastePanelBeerID2;
    @JoinColumn(name = "TastePanelBeerID3", referencedColumnName = "TPBID", nullable=true)
    @ManyToOne(optional = true)
    private TastePanelBeer tastePanelBeerID3;

    public TastePanel() {
    }

    public TastePanel(Integer tastePanelID) {
        this.tastePanelID = tastePanelID;
    }

    public TastePanel(Integer tastePanelID, int tastePanelType, String tastePanelEmpCSV, Date tastePanelDate, String tastePanelNotes) {
        this.tastePanelID = tastePanelID;
        this.tastePanelType = tastePanelType;
        this.tastePanelEmpCSV = tastePanelEmpCSV;
        this.tastePanelDate = tastePanelDate;
        this.tastePanelNotes = tastePanelNotes;
    }

    public Integer getTastePanelID() {
        return tastePanelID;
    }

    public void setTastePanelID(Integer tastePanelID) {
        this.tastePanelID = tastePanelID;
    }

    public int getTastePanelType() {
        return tastePanelType;
    }

    public void setTastePanelType(int tastePanelType) {
        this.tastePanelType = tastePanelType;
    }

    public String getTastePanelEmpCSV() {
        return tastePanelEmpCSV;
    }

    public void setTastePanelEmpCSV(String tastePanelEmpCSV) {
        this.tastePanelEmpCSV = tastePanelEmpCSV;
    }

    public Date getTastePanelDate() {
        return tastePanelDate;
    }

    public void setTastePanelDate(Date tastePanelDate) {
        this.tastePanelDate = tastePanelDate;
    }

    public String getTastePanelNotes() {
        return tastePanelNotes;
    }

    public void setTastePanelNotes(String tastePanelNotes) {
        this.tastePanelNotes = tastePanelNotes;
    }

    public TastePanelBeer getTastePanelBeerID1() {
        return tastePanelBeerID1;
    }

    public void setTastePanelBeerID1(TastePanelBeer tastePanelBeerID1) {
        if(tastePanelBeerID1.getTpbid()!=null){
            this.tastePanelBeerID1 = tastePanelBeerID1;
        }
    }

    public TastePanelBeer getTastePanelBeerID2() {
        return tastePanelBeerID2;
    }

    public void setTastePanelBeerID2(TastePanelBeer tastePanelBeerID2) {
        if(tastePanelBeerID2.getTpbid()!=null){
            this.tastePanelBeerID2 = tastePanelBeerID2;
        }
    }

    public TastePanelBeer getTastePanelBeerID3() {
        return tastePanelBeerID3;
    }

    public void setTastePanelBeerID3(TastePanelBeer tastePanelBeerID3) {
        if(tastePanelBeerID3.getTpbid()!=null){
            this.tastePanelBeerID3 = tastePanelBeerID3;
        }
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tastePanelID != null ? tastePanelID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TastePanel)) {
            return false;
        }
        TastePanel other = (TastePanel) object;
        if ((this.tastePanelID == null && other.tastePanelID != null) || (this.tastePanelID != null && !this.tastePanelID.equals(other.tastePanelID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.TastePanel[ tastePanelID=" + tastePanelID + " ]";
    }
    
}
